package system.action;

import groupby.util.Pages;
import groupby.util.UtilsTools;

import java.util.List;

import net.sf.json.JSONObject;
import system.model.BasicInfor;
import user.manage.UsersManage;

import com.opensymphony.xwork2.ActionSupport;

import dic.manage.DicManage;

public class BasicInforAction extends ActionSupport {

	private UsersManage userManage = null;
	private DicManage dicManage=null;
	private int id;
	private BasicInfor basicInfor=null;
	private String flag=null;
	private String content=null;
	private List listDredgeCitys=null;
	private Pages pages=null;
	private int rows;
	private int page;
	private JSONObject result=null;
	private String title=null;
	private String startTime=null;
	private String endTime=null;
	private List culmnList=null;
    
	@Override
	public String execute() throws Exception {
		
		basicInfor=userManage.getBasicInfor(id);
		if(flag!=null&&flag.equals("0"))
		{
			return "SystemBasicInfor";
		}
		culmnList=userManage.culmnList();
		listDredgeCitys=dicManage.getDredgeCitys();
		return "success";
	}
	public String updateBasicInfor() throws Exception
	{
		BasicInfor bi=new BasicInfor();
		bi.setId(id);
		bi.setContent(content);
		boolean isSuccess=userManage.updateBasicInfor(bi);
		return "update";
	}
	/**
	 * 获得culmnlist
	 */
	public String culmnlist()
	{
		result=userManage.culmnlist();
		return "success";
	}
	/**
	 * 管理栏目
	 * @return
	 */
	public String menageCulmn()
	{
		pages=new Pages();
		pages.setCurrentPage(page);
		pages.setPageSize(rows);
		result=userManage.menageCulmn(pages,title,startTime,endTime);
		return "success";
	}
	/**
	 * 删除栏目
	 * @return
	 */
	public String delculmn()
	{
		result=userManage.delculmn(id);
		return "success";
	}
	/**
	 * 添加栏目
	 * @return
	 */
	public String addculmn()
	{
		result=userManage.addculmn(UtilsTools.convertToChinese(title));
		return "success";
	}
	public UsersManage getUserManage() {
		return userManage;
	}
	public void setUserManage(UsersManage userManage) {
		this.userManage = userManage;
	}
	public BasicInfor getBasicInfor() {
		return basicInfor;
	}


	public int getId() {
		return id;
	}


	public void setId(int id) {
		this.id = id;
	}


	public String getFlag() {
		return flag;
	}


	public void setFlag(String flag) {
		this.flag = flag;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	public List getListDredgeCitys() {
		return listDredgeCitys;
	}
	public DicManage getDicManage() {
		return dicManage;
	}
	public void setDicManage(DicManage dicManage) {
		this.dicManage = dicManage;
	}
	public Pages getPages() {
		return pages;
	}
	public void setPages(Pages pages) {
		this.pages = pages;
	}
	public int getRows() {
		return rows;
	}
	public void setRows(int rows) {
		this.rows = rows;
	}
	public int getPage() {
		return page;
	}
	public void setPage(int page) {
		this.page = page;
	}
	public JSONObject getResult() {
		return result;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getStartTime() {
		return startTime;
	}
	public void setStartTime(String startTime) {
		this.startTime = startTime;
	}
	public String getEndTime() {
		return endTime;
	}
	public void setEndTime(String endTime) {
		this.endTime = endTime;
	}
	public List getCulmnList() {
		return culmnList;
	}
	

	

	
}
